import React from 'react';
import { IUploadListCtx, IUploadListProps } from './interface';

export const InBizUploadCtx = React.createContext<IUploadListProps>({
  fileList: [],
  uploader: {
    on: (type: string, callback: Function) => {},
    off: (type: string, callback: Function) => {},
    options: {
      chunking: {
        enabled: false,
      },
      deleteFile: {
        enabled: false,
      },
    },
    qq: {
      status: {
        CANCELED: '',
        DELETED: '',
        DELETE_FAILED: '',
        DELETING: '',
        PAUSED: '',
        QUEUED: '',
        REJECTED: '',
        SUBMITTED: '',
        SUBMITTING: '',
        UPLOADING: '',
        UPLOAD_EXISNAME: '',
        UPLOAD_FAILED: '',
        UPLOAD_FINALIZING: '',
        UPLOAD_RETRYING: '',
        UPLOAD_SUCCESSFUL: '',
      },
    },
    methods: {
      addFiles: (fileList: { [key: string]: any }[], params: { [key: string]: any }) => {},
      addInitialFiles: (fileList: { [key: string]: any }[]) => {},
      getUploads: (params: { [key: string]: any }) => [],
      getFile: (id: string | number) => ({}),
      retry: (id: string | number) => {},
      pauseUpload: (id: string | number, bool?: boolean) => {},
      continueUpload: (id: string | number) => {},
      getSize: (id: string | number) => 0,
      getName: (id: string | number) => '',
      setName: () => {},
      cancel: () => {},
      deleteFile: () => {},
      getInProgress: () => {},
      _handler: {
        reset: () => {},
      },
      _uploadData: {
        reset: () => {},
      },
    },
  },
  statusEnum: {
    CANCELED: '',
    DELETED: '',
    DELETE_FAILED: '',
    DELETING: '',
    PAUSED: '',
    QUEUED: '',
    REJECTED: '',
    SUBMITTED: '',
    SUBMITTING: '',
    UPLOADING: '',
    UPLOAD_EXISNAME: '',
    UPLOAD_FAILED: '',
    UPLOAD_FINALIZING: '',
    UPLOAD_RETRYING: '',
    UPLOAD_SUCCESSFUL: '',
  },
});

export const InBizUploadListCtx = React.createContext<IUploadListCtx>({
  visibleFiles: [],
  isPackUp: false,
  uploadStatus: '',
  pausable: false,
  surplusNum: 0,
  onDelectAll: () => {},
  onUnwindPackUp: () => {},
  onResumPausedFiles: () => {},
  onClickFileItem: () => {},
  showRenameModal: () => {},
});
